package com.ll.wechat.friends.activity;

import android.content.Intent;
import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.TextView;
import com.ll.wechat.R;
import com.ll.wechat.base.activity.BaseActivity;
import com.ll.wechat.chat.activity.ChatActivity;

/**
 * 好友的个人信息展示
 * 
 * @ClassName: FriendsInfoActivity
 * @author yeliangliang
 * @date 2015-7-28 下午6:20:17
 */
public class FriendsInfoActivity extends BaseActivity implements OnClickListener {

	private TextView tv_name;
	private TextView tv_post_message;// 发消息

	@Override
	public void initView() {
		setContentView(R.layout.activity_friends_info);
		tv_name = (TextView) findViewById(R.id.tv_friends_name);
		tv_post_message = (TextView) findViewById(R.id.tv_friends_post_message);
		tv_post_message.setOnClickListener(this);
	}

	@Override
	public void initData() {
		Intent intent = getIntent();
		tv_name.setText(intent.getStringExtra("name"));

	}

	// 监听返回键，防止内存泄露
	@Override
	public boolean onKeyDown(int keyCode, KeyEvent event) {
		if (keyCode == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_DOWN) {
			finishActivity(FriendsInfoActivity.this);
			return true;
		}
		return super.onKeyDown(keyCode, event);
	}

	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.tv_friends_post_message://跳转到聊天界面
			showActivity(FriendsInfoActivity.this, ChatActivity.class);
			break;

		default:
			break;
		}
	}
}
